package com.shejimoshi.单例模式.深浅克隆.深克隆.实现cloneAble进行深度复制;

public class Test {
    public static void main(String[] args) {
        String name = "1";
        int age = 1;
        Integer[] somthings = new Integer[3];
        somthings[0] = 0;
        Food food = new Food("1",1);
        Person person = new Person(name,age, food); // 如果没有申明无参构造函数，且已经申明有参构造函数， 那么就不可以单独使用
        person.setSomtins(somthings);
        Person personnew = null;
        try {
            personnew = (Person) person.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        System.out.println(person == personnew);
        System.out.println("------------------------------");
        food.setName("2");
        food.setWeight(2);
        somthings[0] = 1;
        System.out.println(person.toString());
        System.out.println(personnew.toString());
    }
}
